user,pasword = 'ouyang',"abc"
def auth(auth_type):
    print('auth func',auth_type)
    def outer_wrapper(func):
        def wrapper(*args, **kwargs):
            print("wrapper func args:",args,kwargs)
            if auth_type=="local":
                username = input('username:').strip()
                password = input('pasword:').strip()
                if user == username and pasword == password:
                    print("\033[32:1mUser has passed authentication\033[0m")
                    res = func(*args, **kwargs)  # from home
                    print('----after---authentication')
                    return res
                else:
                    exit("\033[31:1mInvalid username or password\033[0m")
            elif auth_type =="lday":
                print("不会啊")
        return wrapper
    return outer_wrapper

def index():
    print('welcome to index page')

@auth(auth_type='local')  # home = wrapper()
def home():
    print('welcome to home page')
    return 'from home'

@auth(auth_type='lday')
def bbs():
    print('welcome to bbs page')

index()
print(home())  #打印home（）的返回结果，，wrapper（）
bbs()